var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		id : 'paging',
		l_column : [ {
			colkey : "name",
			name : "食品名称",
		}, {
			colkey : "w_id",
			name : "窗口id"
		},{
			colkey : "price",
			name : "价格",
		} , {
			colkey : "saleNum",
			name : "销量"
		}, {
			colkey : "left",
			name : "剩余量"
		}, {
			colkey : "optionNum",
			name : "点购"
		}, {
			colkey : "button",
			name : "操作",
			width : "70px"
		}],
		jsonUrl : rootPath + '/usermanage/findByPage.shtml',
		checkbox : true,
		serNumber : true
	});
	$("#searchForm").click("click", function() {// 绑定查询按扭
		var searchParams = $("#fenye").serializeJson();
		grid.setOptions({
			data : searchParams
		});
	});
});

function cc(num){
	var wfid = $("#wfid"+num).val();
	var num = $("#num"+num).val();
	var data = wfid+"#"+num;
	if(num <1){
		alert("数量不能小于1");
		return ;
	}
//	$("#order"+num).css('display','none');
//	$("#can"+num).css('display','block');
	
	var url = rootPath + '/usermanage/order.shtml';
		var s = CommnUtil.ajax(url, {
			ids : data
		}, "json");
		if (s == "success") {
			layer.msg('订购成功');
//			grid.loadData();
		} else {
			layer.msg('订购失败');
		}
}
function cancel(num){
	alert($("#num"+num).val());
	$("#order"+num).css('display','block');
	$("#can"+num).css('display','none');
}
function wid(){
	var searchParams = $("#searchForm1").serializeJson();// 初始化传参数
	grid.setOptions({
		data : searchParams,
		jsonUrl : rootPath + '/usermanage/selectWindow.shtml'
	});
}

function ftype(){
	var searchParams = $("#searchForm1").serializeJson();// 初始化传参数
	grid.setOptions({
		data : searchParams,
		jsonUrl : rootPath + '/usermanage/selectFtype.shtml'
	});
}